package com.hoangkien.service;

import java.util.ArrayList;

import com.hoangkien.DAO.CreateDatabase;
import com.hoangkien.DAO.SoundCloudDAO;
import com.hoangkien.DAO.UserDAO;
import com.hoangkien.entity.SoundCloudEntity;
import com.hoangkien.entity.UserEntity;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;

@SuppressWarnings("unused")
public class SoundCloudService {
	private Context context;

	public SoundCloudService(Context context) {
		this.context = context;
	}
	
	public long insert_soundCloud(SoundCloudEntity soundCloudEntity){
		CreateDatabase createDb = new CreateDatabase(context);
		SQLiteDatabase db = createDb.open();
		SoundCloudDAO soundCloudDAO = new SoundCloudDAO(db);
		long result = soundCloudDAO.insert_soundcloud(soundCloudEntity);
		db.close();
		createDb.close();
		return result;
	}
	
	public ArrayList<SoundCloudEntity> getAllSoundCloud(){
		CreateDatabase createDb = new CreateDatabase(context);
		SQLiteDatabase db = createDb.open();
		SoundCloudDAO soundCloudDAO = new SoundCloudDAO(db);
		ArrayList<SoundCloudEntity> list_soundCloud = new ArrayList<SoundCloudEntity>();
		list_soundCloud = soundCloudDAO.getAllSoundCloud();
		db.close();
		createDb.close();
		return list_soundCloud;
	}
	
	public long deleteSoundCloud(){
		CreateDatabase createDb = new CreateDatabase(context);
		SQLiteDatabase db = createDb.open();
		SoundCloudDAO SoundCloudDAO = new SoundCloudDAO(db);
		long result = SoundCloudDAO.deleteTableSoundCloud();
		db.close();
		createDb.close();
		return result;
	}
}
